<?php
/**
 * Created by PhpStorm.
 * User: lv
 * Date: 16/7/21
 * Time: 下午3:50
 */
namespace Wcs;
use \Wcs\Upload\Uploader;
use \Wcs\Upload\ResumeUploader;
use \Wcs\SrcManage\FileManager;
use Wcs\SrcManage\FileDownloader;
class WcsFactory {
    private static $_WcsFileManager = null;
    private static $_WcsFileDownloader = null;
    private static $_WcsFileUploader = null;
    private static $_WcsFileSliceUploader = null;
    //普通上传
    public static function normalUpload($userparam=null,$uservar=null,$mimetype=null) {
        if(null === self::$_WcsFileUploader) {
            self::$_WcsFileUploader = new Uploader($userparam,$uservar,$mimetype);
        }
        return self::$_WcsFileUploader;
    }
    //分片上传
    public static function sliceUpload($userparam=null,$uservar=null,$mimetype=null) {
        if(null === self::$_WcsFileSliceUploader) {
            self::$_WcsFileSliceUploader = new ResumeUploader($userparam,$uservar,$mimetype);
        }
        return self::$_WcsFileSliceUploader;
    }
    //文件管理
    public static function managerFile(){
        if(null === self::$_WcsFileManager) {
            self::$_WcsFileManager = new FileManager();
        }
        return self::$_WcsFileManager;
    }

    public static function getFileDownloader() {
        if(null === self::$_WcsFileDownloader) {
            self::$_WcsFileDownloader = new FileDownloader();
        }
        return self::$_WcsFileDownloader;
    }
//    public static function getWcsFileUploader() {
//        if(null === self::$_WcsFileUploader) {
//            self::$_WcsFileUploader = new \WcsFileUploader();
//        }
//        return self::$_WcsFileUploader;
//    }
}